/* Printer status information. */
/** @file

    The file contains definitions, structures and declarations with
    are used by various parts of the program. */
/* General definitions */
/* Created 27.09.2005 T. Milius
   Changed 27.09.2005 T. Milius */
/* (c) Copyright 2005 by Thomas Milius Stade, Germany
   Source must not be altered without agreement of the owner.
   The owner of the source is allowed to use this code inside programs without
   publishing the code of this programs. These programs may be commercial.
   Other developers can use this source freely inside own software if the source
   code of this programs is made public to same conditions like valid to this code
   and no commercial profit is taken from the programs based on this code

   Code or parts of it are not allowed to be used within GPL code or
   similar licenses which are "infecting" other code and trying to "supersede"
   other licenses. */
/* ANSI-C */

#ifndef common_h
#define common_h

/* !!!!!!!!!! libraries !!!!!!!!!! */

/* !!!!!!!!!!! definitions !!!!!!!!!! */
#define MAX_STRING_LENGTH 256
#define MAX_NAME_LENGTH   50
#define MAX_CONNECTION_NAME 256

#define MAX_PENDING_ACTIONS 10

/* internal Errors used by several libraries from 0x01 onwards */
#define ERROR_WRONG_CALL 1
#define ERROR_DEBUG      2

/* Matches connection.
   Also used as values for INTERFACE */
#define ACTION_MODE_TAG_NOT_SPECIAL "Arbitrary"
#define ACTION_MODE_TAG_PARALLEL    "Parallel"
#define ACTION_MODE_TAG_USB         "USB"

#define POLL_SIMPLE  0
#define POLL_ACTION  1
#define POLL_NETWORK 2
#define POLL_ALL     3

/* !!!!!!!!!! data structures !!!!!!!!!! */
struct pending_action_struct {
struct status_struct *status;
int action;
int sub_selection;
};

struct {
/* Actions */
struct pending_action_struct pending_action[MAX_PENDING_ACTIONS];
int no_of_pending_actions;
unsigned long last_activity_time;
/* Program control */
struct status_struct *first_status;
bool shutdown_flag;
/* Debug */
bool trace_on;
} common;

/* !!!!!!!!!! support functions !!!!!!!!!! */

/* !!!!!!!!!! functions !!!!!!!!!! */
extern void my_poll(unsigned long poll_mask);

/* For debug purposes */
extern bool show_message(int message_number,
                         FILE *trace,
                         ...);

#endif
